{% macro image(product, config = {}) %}
    {% set config = {
        class: 'img-fluid',
        type: 'thumbnail',
        filter: 'sylius_admin_product_thumbnail'
    }|merge(config) %}

    {% if product.imagesByType(config.type) is not empty %}
        {% set path = product.imagesByType(config.type).first.path|imagine_filter(config.filter) %}
    {% elseif product.images.first %}
        {% set path = product.images.first.path|imagine_filter(config.filter) %}
    {% else %}
        {% set path = asset('bundles/syliusui/images/200x200.png') %}
    {% endif %}

    <img src="{{ path }}" alt="{{ product.name }}" class="{{ config.class }}" />
{% endmacro %}
